//
//  GUAServerRequest.h
//  GUAFrameCreate
//
//  Created by Guava on 16/1/27.
//  Copyright © 2016年 Guava. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

/**
 使用了AFNetworking 中的AFHTTPSessionManager进行 简单的get和post请求
 输出一些请求获得的信息，或者错误信息。
 进行一些辅助功能：1.请求超时.
 */
//typedef void (^AFSuccessResponseBlock)( NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject);
//typedef void (^AFFailureResponseBlock)( NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error);

@interface GUAServerRequest : NSObject

+ (void)postImageWithUrl:(nullable NSString *)url
         imageDictionary:(nullable NSDictionary <NSString *, NSData *> *)imageDictinary
              parameters:(nullable id)parameters
                 success:(nullable void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject))success
                 failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;


+ (void)GETWithURL:(nonnull NSString *)URL
        parameters:(nullable id)parameters
           success:(nullable void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject))successResponse
           failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failureResponse
            inView:(nullable UIView *)view;


+ (void)POSTWithURL:(nonnull NSString *)URL
         paramaters:(nullable id)parameters
            success:(nullable void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject))success
            failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure
             inView:(nullable UIView *)view;

+ (void)silencedGETWithURL:(nonnull NSString *)URL
                parameters:(nullable id)parameters
                   success:(nullable void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject))successResponse
                   failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failureResponse;

+ (void)silencedPOSTWithURL:(nonnull NSString *)URL
                 paramaters:(nullable id)parameters
                    success:(nullable void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject))success
                    failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
@end
